- @section = 'events'
- @page_title = @event.name
-widget do
  %ul.list-unstyled
    - if @is_admin_user
      %li
        = link_to :administer_events.l, admin_events_path
    %li
      = link_to fa_icon('plus-circle', :text => :see_all_events.l), events_path
=render :partial=>'subscribe'

- if (logged_in? && (@event.user.eql?(current_user) || admin?))
  %p
    = link_to :back.l, events_path, :class => 'btn btn-default'
    = link_to :clone.l, clone_event_path(@event), :class => 'btn btn-success'
    = link_to :edit.l, edit_event_path(@event), :class => 'btn btn-warning'
    = link_to :delete.l, event_path(@event), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger'


%dl.dl-horizontal
  %dt=:when.l
  %dd=@event.time_and_date
  - unless @event.location.blank?
    %dt= :where.l+":"
    %dd
      = @event.location
      = link_to :map_it.l, "http://www.google.com/maps?q=#{URI::encode(@event.location)}", :title=>:map_it.l, :target=>'_blank'
  - if @event.allow_rsvp?
    %dt=:rsvps.l
    - attending = @event.attendees_count == 1 ? :is_attending_this_event.l : :are_attending_this_event.l
    %dd
      = pluralize(@event.attendees_count, 'person') + ' ' + attending
      .btn-group
        - if @event.end_time > Time.now
          - if rsvp = @event.rsvped?(current_user)
            = link_to :retract_rsvp.l, [@event, rsvp], data: { confirm: :are_you_sure.l }, :method=>:delete, :class => 'btn btn-primary btn-xs'
            = link_to :update_rsvp.l, edit_event_rsvp_url(@event, rsvp), :class => 'btn btn-primary btn-xs'
          - else
            = link_to :rsvp.l, new_event_rsvp_url(@event), :class => 'btn btn-primary btn-xs'

= @event.description.html_safe unless @event.description.blank?
- unless @event.attendees.blank?
  %dl.dl-horizontal
    %dt=:attendees.l
    %dd
      %ul
        - @event.attendees.each do |user|
          %li
            = link_to h(user.display_name), user_path(user)
            - if (count = @event.attendees_for_user(user)) > 1
              %span.badge.badge-info= "+#{count-1}"


%h2= :event_comments.l
%h3= :add_your_comment.l
= render :partial => 'comments/comment_form', :locals => {:commentable => @event}
%a#newest_comment
= render :partial => 'comments/comment', :collection => @comments
%span#more_comments_links= more_comments_links(@event)
